package com.mentaleye.util;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.mentaleye.dal.model.StudentDisciplineRecord;

public class DisciplineDataUtil {
	
	public static List<Integer> getStudentIdList(List<StudentDisciplineRecord> recordList){
    	int studentId=0;
    	List<Integer> studentIdList=new ArrayList<Integer>();
    	for (StudentDisciplineRecord record : recordList) {
    		if(studentId!=record.getStudentId()){
    			studentIdList.add(studentId);
    		}
    		studentId=record.getStudentId();
		}
		return studentIdList;
    }
	
	public static List<Date> getWriteTimeList(List<StudentDisciplineRecord> recordList,String formatter){
    	Date writeTime=new Date();
    	List<Date> writeTimeList=new ArrayList<Date>();
        for (StudentDisciplineRecord record : recordList) {
        	writeTime=DateFormatter.parse(
            		DateFormatter.format(record.getWriteTime(), formatter), formatter) ;
        	if(!writeTime.equals(writeTime)){
        		writeTimeList.add(writeTime);
        	}
        	writeTime=record.getWriteTime();
		}
		return writeTimeList;
    }
}
